package com.itheima.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.health.pojo.Order;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**

 */
public interface OrderMapper extends BaseMapper<Order> {

    @Select("select count(1) from t_order where SETMEAL_ID = #{sid} and ORDERDATE= #{orderdate} and MEMBER_ID = #{mid}")
    int findOrderBySetmealIdAndOrderdateAndMemberId(@Param("sid") int sid, @Param("orderdate") String orderdate, @Param("mid") int mid);

    @Select("select ts.name as setmeal , tm.name as member , tor.ORDERTYPE as orderType , tor.ORDERDATE as orderDate " +
            "from  t_setmeal ts,t_order tor ,t_member tm " +
            "where  tor.SETMEAL_ID = ts.id and tor.MEMBER_ID = tm.id  " +
            "and  tor.id = #{id}")
    Map findOrderInfoByOrderId(@Param("id") int id);



}
